define(function(require) {
	require("jquery");
	var appInfo = require('app/AppInfo');
	var c = require('app/utils/CommonUtils');
	var hc = require('app/utils/HttpClientUtils');
	var tip = require('app/utils/TipUtils');
	var dbu = require('app/utils/DBUtils');
	var TimerUtils = require("app/utils/TimerUtils");
	var win = window;
	var action = {};
	action.countDown = function() {
		$("#identifying_code_btn").unbind("click");
		$("#identifying_code_btn").attr("class", "aui-btn aui-btn-block aui-btn-outlined aui-btn-sm");
		var seconds = 60;
		TimerUtils.startTimer(1000, function(){
			
			seconds -= 1;
			$("#identifying_code_btn").text(seconds + "s");
			if (seconds == 0) {
				$("#identifying_code_btn").text("获取验证码");
				TimerUtils.stopTimer();
				$("#identifying_code_btn").bind("click", function() {
					action.getIdentifyingCode();
				});
				$("#identifying_code_btn").attr("class", "aui-btn aui-btn-block aui-btn-info aui-btn-outlined aui-btn-sm");
				return;
			}		
		});
	}
	action.getIdentifyingCode = function() {
		var tel = $("#tel_number").val();

		if (!c.isTel(tel)) {
			tip.show("请正确输入手机号");
			return;
		}
		var url = appInfo.serverbase + "/luyan/code_send";
		var body = {
			phoneNum : tel
		}
		hc.post(url, body, function(resp) {

			if (resp.status == 200) {
				action.countDown();
			}
		});
	}
	action.resetPSD = function() {
		alert("resetPSD");
		//		POST:url
		//		／luyan/reset/tel/{tel}/smscode/{smscode}/pwd/{pwd}
		//		body: null
		//		返回值：
		//		resp.status
		//		201 - 表示重置成功
		//		200 - 表示处理成功但有错误提示，resp.result值"该手机号未被注册","验证码不正确或已过期"

	}
	action.openRegistWin = function() {
		var name = "RegistWin";
		api.openWin({
			name : name,
			url : './' + name + '.html',
			rect : {
				x : 0,
				y : 0,
				w : api.frameWidth,
				h : api.frameHeight
			},
		});
	}
	return action;
});
